
let returnData = {
    success: { // 成功
        code: '0',
        msg: '操作成功'
    }, 
    error: {  // 入参错误
        code: '1',
        msg: '错误'
    },
    def: {  // 该数据不存在
        code: '2',
        msg: '缺少字段'
    },
    exist: { // 该数据已存在
        code: '3',
        msg: '该数据已存在'
    },
    server: {
        code: '500',
        msg: '服务器发生异常'
    },
    due: {
      code: '4',
      msg: 'token过期，请重新登录'
    },
    delete: {
      code: '5',
      msg: '该数据已删除'
    }
}


  // 正则
let validators = {
    mobile: {
      reg: /^1\d{10}$/,
      message: '请输入正确的手机号',
    },
    authcode: {
      reg: /^\d{6}$/,
      message: '请输入6位手机验证码'
    },
    password: {
      reg: /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{6,}$/,
      message: '密码至少包含大写字母、小写字母、数字、特殊字符其中三种，长度不少于6位'
    },
    // 邮箱正则
    email: {
      reg: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
      message: '请输入正确的邮箱'
    },
    // 微信号规则
    weixin: {
      reg: /^[a-zA-Z]{1}[-_a-zA-Z0-9]{5,19}$/,
      message: '请输入正确的微信号'
    },
    // QQ号规则
    QQ: {
      reg: /^[1-9]\d{5,10}$/,
      message: '请输入正确的QQ号'
    },
}

let security = {
  secretKey: '4e~*3j_&+2;,a95686iAapttwoE_!*,9',//用来生成token的key值
  expiresIn: 60 * 60 * 24 * 31 * 365//过期时间 一个月
}

// 人员的权限
let jurisdiction =  {
  super: 1,
  manage: 2,
  personnel: 3,
  looker: 4
}

exports.returnData = returnData;
exports.validators = validators;
exports.security = security;
exports.jurisdiction = jurisdiction;

